package com.tao.controller;

import com.tao.service.UserService;
import com.tao.utils.SecurityUtils;
import com.tao.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wz
 * @since 2023-05-07
 */
@RestController
@RequestMapping("/balance")
public class BalanceController {

    @Resource
    private UserService userService;


    /**
     * 查询余额
     */
    @GetMapping("/selectByUserId")
    public ResponseResult selectByUserId() {
        return userService.selectByUserId(SecurityUtils.getUserId());
    }

    /**
     * 充值
     */
    @PostMapping("/topUp")
    public ResponseResult topUp(@RequestParam Integer money) {
        return userService.topUp(SecurityUtils.getUserId(),money);
    }
}
